#!/bin/bash
filename=$2

if [ -z $filename ]; then
  ehco "传递参数 $2 为空"
fi

array=(${filename//.yml/})

if [ $1 == 'start' ]; then
  docker-compose -f $filename -p ${array[0]} up -d
elif [ $1 == 'stop' ]; then
  docker-compose -f $filename -p ${array[0]} down
elif [ $1 == 'restart' ]; then
  docker-compose -f $filename -p ${array[0]} down
  sleep 5s
  docker-compose -f $filename -p ${array[0]} up -d
else
  echo "传递参数 $1 无效"
fi
